# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=erlang-ls
pkgver=1.1.0
pkgrel=0
pkgdesc="Erlang Language Server"
url="https://erlang-ls.github.io/"
arch="noarch"
license="Apache-2.0"
depends="erlang"
makedepends="erlang-dev rebar3"
checkdepends="erlang-doc"
source="https://github.com/erlang-ls/erlang_ls/archive/refs/tags/$pkgver/erlang-ls-$pkgver.tar.gz
	fix-version.patch
	"
builddir="$srcdir/erlang_ls-$pkgver"

prepare() {
	default_prepare

	sed -i "s/@ERLANG_LS_VERSION@/$pkgver/" \
		apps/els_lsp/src/els_lsp.app.src

	rebar3 get-deps
	if want_check; then
		rebar3 as test get-deps
	fi
}

build() {
	rebar3 escriptize
}

check() {
	rebar3 ct
	rebar3 proper --constraint_tries 100
}

package() {
	install -Dvm755 _build/default/bin/erlang_ls \
		-t "$pkgdir"/usr/bin/
}

sha512sums="
c234211d56a6dd830400ccf24dae47c2682390f1f978d4249aa1607f04a2af696312f05268a561676fa135c4c4962ffe43c8eea2286406ea24f12fa8b2622f32  erlang-ls-1.1.0.tar.gz
0ac1763015d6fa0c5feb407bafc965cae9e34eed160873275fd6291e35352015ccb0b9535f812ee125587274bda1e8a4844ec8b6df5b15adde56b66f8452079c  fix-version.patch
"
